import pandas as pd
from script_convert_rating import filter_unused_data


def convert_ratings(input_fname, output_fname):
    rating = pd.read_csv(input_fname, sep="\t", index_col=None, header=None)
    rating.columns = ['userID', 'itemID', 'rating']
    rating.dropna(axis=1, inplace=True)

    order_l = ['userID', 'itemID', 'rating']
    rating = rating[order_l]

    rating = filter_unused_data.convert_ratings(rating)

    rating.to_csv(output_fname, index=False)
    print("complete {}".format(output_fname))
